﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/admin/AdminMaster.master" CodeFile="AddAdminer.aspx.cs" Inherits="AddAdminer" Theme="txtskin" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="AdminRight">
    <div class="rightHeader1">
        <div class="rightHLeft"><span class="rightHeaderTitle">当前位置</span></div>
        <div class="rightHMiddle2">
            <span>
                <a href="Default.aspx" class="moreRight" style="float: left;">首页</a>
            </span>
        </div>
        <div class="rightHRight"></div>
    </div>
    <div style="margin-top: 10px; width: 760px; border: 1px solid #ddd;overflow:hidden;padding:10px;">
        <table style="width: 410px;float:left;">
            <tr>
                <td colspan="2" style="text-align: center;">
                    <span style="font-size: 20px; font-weight: 600; color: #159fde;">添加系统用户</span>
                </td>
                <td>&nbsp;</td>
            </tr>
            <tr>
                <td style="text-align: right; width: 80px;">用 户：</td>
                <td style="text-align: left; width: 150px;">
                    <asp:TextBox ID="txtname" runat="server" Width="150px"></asp:TextBox>
                </td>
                <td style="text-align: left;">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
                        ControlToValidate="txtname" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">密 码：</td>
                <td style="text-align: left;">
                    <asp:TextBox ID="txtpwd" runat="server" TextMode="Password" Width="150px"></asp:TextBox>
                </td>
                <td style="text-align: left;">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                        ControlToValidate="txtpwd" ErrorMessage="*"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;">确认密码：</td>
                <td style="text-align: left;">
                    <asp:TextBox ID="txtva" runat="server" TextMode="Password" Width="150px"></asp:TextBox>
                </td>
                <td style="text-align: left;">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
                        ControlToValidate="txtva" ErrorMessage="*"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="CompareValidator1" runat="server"
                        ControlToCompare="txtpwd" ControlToValidate="txtva" ErrorMessage="两次输入的密码不一致!"></asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td>&nbsp;</td>
                <td style="text-align: left;">
                    <asp:Button ID="Button1" runat="server" Font-Strikeout="False" Height="30px" Width="60px" BackColor="#159fde" ForeColor="White"
                        Font-Underline="False" OnClick="Button1_Click" Text="添 加" />
                </td>
            </tr>
        </table>
        <div style="float:left;text-align:center;">
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True"  
                AutoGenerateColumns="False" BackColor="White" BorderColor="#dddddd"
                BorderStyle="None" BorderWidth="1px" CellPadding="4" DataKeyNames="aid"
                DataSourceID="SqlDataSource1" ForeColor="Black" GridLines="none"
                Width="320px">
                <FooterStyle BackColor="#1f93e0" ForeColor="#333333" />
                <RowStyle BackColor="White" ForeColor="#333333" />
                <PagerStyle BackColor="#1f93e0" ForeColor="#FFFFFF" HorizontalAlign="Center" />
                <Columns>
                    <asp:BoundField DataField="aid" HeaderText="编号" InsertVisible="False"
                        ReadOnly="True" SortExpression="aid" />
                    <asp:BoundField DataField="aname" HeaderText="用户名" SortExpression="aname" />
                    <asp:CommandField ShowDeleteButton="True" />
                </Columns>
                <SelectedRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#1f93e0" Font-Bold="True" ForeColor="#FFFFFF" />
                <AlternatingRowStyle BackColor="WhiteSmoke" />
            </asp:GridView>
        </div>
    </div>
    <asp:Label ID="Label1" runat="server"></asp:Label>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConflictDetection="CompareAllValues"
        ConnectionString="<%$ ConnectionStrings:DB_CCXYRCConnectionString %>"
        DeleteCommand="DELETE FROM [adminer] WHERE [aid] = @original_aid"
        InsertCommand="INSERT INTO [adminer] ([aname], [apwd]) VALUES (@aname, @apwd)"
        OldValuesParameterFormatString="original_{0}"
        SelectCommand="SELECT * FROM [adminer]"
        UpdateCommand="UPDATE [adminer] SET [aname] = @aname, [apwd] = @apwd WHERE [aid] = @original_aid AND [aname] = @original_aname AND [apwd] = @original_apwd">
        <DeleteParameters>
            <asp:Parameter Name="original_aid" Type="Int32" />
        </DeleteParameters>
        <UpdateParameters>
            <asp:Parameter Name="aname" Type="String" />
            <asp:Parameter Name="apwd" Type="String" />
            <asp:Parameter Name="original_aid" Type="Int32" />
            <asp:Parameter Name="original_aname" Type="String" />
            <asp:Parameter Name="original_apwd" Type="String" />
        </UpdateParameters>
        <InsertParameters>
            <asp:Parameter Name="aname" Type="String" />
            <asp:Parameter Name="apwd" Type="String" />
        </InsertParameters>
    </asp:SqlDataSource>
</asp:Content>
